<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title> [[${pageTitle}]] - [[${T(com.b2c.erp.DataConfigObject).getInstance().getSysName()}]]</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;">
    <style type="text/css">
        .T-box {
            width: 400px;
            padding: 0 20px;
            text-align: left;
        }

        .T-box p {
            position: relative;
            height: 36px;
            line-height: 36px;
            font-size: 14px;
            margin-bottom: 15px;
        }

        .T-box p span {
            display: inline-block;
            padding-right: 15px;
            text-align: right;
            width: 110px;
            line-height: 36px;
            font-size: 14px;
        }

        .T-box p input, .T-box p select {
            width: 160px;
            padding: 0 5px;
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            border: 1px solid #d3d3d3;
            outline: none;
        }

        .T-box p i {
            padding: 0 10px;
            line-height: 36px;
            font-style: normal;
        }

        .T-box p b {
            display: inline-block;
            margin-left: 10px;
            cursor: pointer;
            width: 60px;
            height: 36px;
            line-height: 36px;
            background: #c33;
            color: #fff;
            text-align: center;
            font-size: 13px;
            font-weight: normal;
        }

        .T-result {
            margin-bottom: 0;
        }

        .T-result em {
            color: #c33;
            font-style: normal;
        }
    </style>

    <!-- content starts -->
    <!--    <blockquote class="layui-elem-quote">待发货订单</blockquote>-->

    <fieldset class="layui-elem-field">
        <legend>按条件搜索</legend>
        <div class="layui-field-box">
            <form class="layui-form layui-form-pane1" method="get" action="/funds/detail_list">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <input type="text" name="sourceNo" placeholder="来源单据编号" class="layui-input" th:value="${sourceNo}">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="type" id="type">
                                <option value="">类型</option>
                                <option value="1" >支出</option>
                                <option value="2" >收入</option>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <select name="source" id="source">
                                <option value="">来源</option>
                                <option value="PURCHASE" >采购付款</option>
                                <option value="PURREFUND" >采购退款</option>
                                <option value="TIXIAN" >店铺提现</option>
                                <option value="YINGXIAO" >营销费用</option>
                                <option value="SHOPORDER" >网店订单收入</option>
                            </select>
                        </div>

                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="createDate" id="startTime"
                                   placeholder="yyyy-MM-dd" autocomplete="off" th:value="${createDate}">
                        </div>

                    </div>
                    <div class="layui-inline">
                        <button type="submit" class="layui-btn">搜索</button>
                        <i>总共：&nbsp;[[${totalSize}]]&nbsp;条记录</i>
                    </div>
                    <div class="layui-inline"></div>
                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-normal" href="/order_delivery/order_return_djh_export" >导出数据</a>
                    </div>
                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-normal" href="javascript:;" id="add_fund">添加收支记录</a>
                    </div>
                </div>
            </form>

        </div>
    </fieldset>

    <!-- start dd-wrapper -->
    <link rel="stylesheet" href="/css/order.css"/>
    <link rel="stylesheet" href="/sb/stock.css"/>
    <div class="dd-wrapper">
        <div class="sp-table">
            <table>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>日期</th>
                    <th>金额</th>
                    <th>类型</th>
                    <th>来源</th>
                    <th>来源单号</th>
                    <th>备注</th>
                    <th>生成时间</th>
                </tr>
                </thead>
                <tbody id="sp-data">

                <tr th:each="item:${lists}">
                    <td >
                        <b th:text="${item.getId()}"></b>
                    </td>
                    <td>
                        <p><b th:text="${item.createDate}"></b></p>
                    </td>
                    <td th:text="${item.amount}"></td>

                    <td>
                        <p>
                            <b th:if="${item.type ==1 }" style="color: green">支出</b>
                            <b th:if="${item.type ==2 }" style="color: red">收入</b>
                        </p>
                    </td>
                    <td><b th:text="${item.source}"></b></td>
                    <td><b th:text="${item.sourceNo}"></b></td>
                    <td>
                        <span style="color: rgb(126, 126, 126)" th:text="${#strings.abbreviate(item.remark,20)}" th:title="${item.remark}"></span>
                    </td>
                    <td><b th:text="${item.createTime}"></b></td>
              

                </tr>
                </tbody>
            </table>
            <div class="layui-box layui-laypage layui-laypage-default pageBox">
                <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
            </div>
        </div>



    </div>
    <!-- end dd-wrapper -->


    <script src="/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        layui.use(['laydate', 'layer','form'], function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#startTime'
            });
        });
        var r = /^\+?[1-9][0-9]*$/;
        $(function () {

            $('#allCheck').on('change', function (e) {
                var checked = $('#allCheck').prop('checked');
                $('.currCheck').prop('checked', checked);
                $('#order-num').text(getNum());
                $('#order-num_').text(getNum());
            });

            $('.currCheck').on('change', function (e) {
                var allChecked;
                for (var i = 0; i < $('.currCheck').length; i++) {
                    var checked = $('.currCheck').eq(i).prop('checked');
                    if (!checked) {
                        $('#allCheck').prop('checked', false);
                        $('#order-num').text(getNum());
                        $('#order-num_').text(getNum());
                       return;
                    }
                }
                $('#allCheck').prop('checked', true);
                $('#order-num').text(getNum());
                $('#order-num_').text(getNum());
            });

            function getNum() {
                var num = 0;
                for (var i = 0; i < $('.currCheck').length; i++) {
                    var checked = $('.currCheck').eq(i).prop('checked');
                    if (checked) {
                        num++;
                    }
                }
                return num;
            }


            $("#add_fund").click(function () {
                layer.open({
                    type: 2,
                    title: '打印采购单',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['500px', '55%'],
                    content: '/funds/create' //iframe的url
                });
            })

        });
    </script>
</div>


</body>
<html>
